import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count: 100,
    name: "mengyuan"
  },
  getters: {
  },
  mutations: {
    increment(state,num){
      state.count+=num;
    },
    decrement(state,num){
      this.state.count-=num;
    }
  },
  actions: {
    asyncIncrement(context,num){
      setTimeout(()=>{
        context.commit("increment",num)
      },1000)
    }
  },
  modules: {
  }
})
